package com.mxc.website.util;

public class R {
    private int status;
    private String message;
    private Object data;

    public R(int status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    // 提供一个方便的静态方法来创建成功的响应
    public static R ok(Object data) {
        return new R(200, "OK", data);
    }
    public static R ok() {
        return new R(200, "OK", null);
    }

    // 提供一个方便的静态方法来创建错误的响应
    public static R error(String message) {
        return new R(500, message, null);
    }
}